<!--
 * @Author: zk
 * @Date: 2021-01-22 14:09:27
 * @LastEditors: zk
 * @LastEditTime: 2021-01-22 14:09:44
 * @Description:
-->
<template>
  <el-row>
    <div class="buttonLeft">
      <el-button
        v-for="item in mainButton"
        :key="item.label"
        :icon="item.icon"
        :type="item.type"
        @click="item.handle()"
      >
        {{ item.label }}
      </el-button>
    </div>
    <div class="buttonRight">
      <el-button type="primary" @click="searchHandle">查询</el-button>
      <el-button type="primary" @click="resetHandle">重置</el-button>
    </div>
  </el-row>
</template>

<script>
import { eventBus } from '@/main.js'
export default {
  name: 'MainButton',
  props: {
    mainButton: {
      type: Array,
      default: () => {
        return []
      }
    }
  },
  data() {
    return {}
  },
  mounted() {},
  methods: {
    advancedSearchHandle() {
      this.$emit('advanced-search-handle', 'commonForm')
    },
    // 点击查询按钮
    searchHandle() {
      this.$emit('toMainSearch', 'commonForm')
    },
    // 点击重置按钮
    resetHandle() {
      this.$emit('toMainSearchReset', 'commonForm')
    }
  }
}
</script>

<style lang="scss" scoped>
.el-row {
  // display: flex;
  // justify-content: space-between;
  .buttonLeft {
    float: left;
  }
  .buttonRight {
    float: right;
  }
}
</style>
